package com.example.bms.storehouse.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.common.utils.PageUtils;
import com.example.common.utils.Query;

import com.example.bms.storehouse.dao.ProviderDao;
import com.example.bms.storehouse.entity.ProviderEntity;
import com.example.bms.storehouse.service.ProviderService;
import org.springframework.util.ObjectUtils;

import javax.annotation.Resource;


@Service("providerService")
public class ProviderServiceImpl extends ServiceImpl<ProviderDao, ProviderEntity> implements ProviderService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<ProviderEntity> queryWrapper=new QueryWrapper<ProviderEntity>();

        String name =(String) params.get("name");


        if(!ObjectUtils.isEmpty(name)){
            queryWrapper.like("name",name);
        }

        IPage<ProviderEntity> page = this.page(
                new Query<ProviderEntity>().getPage(params),
                queryWrapper
        );

        return new PageUtils(page);
    }

}